// 对业务接口进行统一的管理
import {
	fetch
} from './fetch.js'
export const ApiIndex = () => fetch('/index/index', {}, {}, 'GET')
// /auth/loginByWeb{

// 登录
export const loginByWeb = (data) => fetch('/auth/loginByWeb', data)
// export const loginByWeb = () => fetch('/auth/loginByWeb', {
// 	username: 1303001111,
// 	pwd: 123456
// })
// 加入购物车/cart/add
export const Apiadd = (header) => fetch('/cart/add', {}, header)
// 品牌详情
export const ApiBrandlLhx = id => fetch('/brand/detail', id, {}, 'GET')

// 品牌详情中的产品列表，  相关产品（商品）
export const ApiGoodsLhx = params => fetch('/goods/list', params, {}, 'GET')

// 产品明细
export const ApiDetailLhx = id => fetch('/goods/detail', id, {}, 'GET')

// 相关产品
export const ApiRelatedLhx = id => fetch('/goods/related', id, {}, 'GET')

// 分类页/goods/category
// export const Apicategory = (id) => fetch('/goods/category', id, {}, 'GET')
// 详情页/brand/detail
export const Apibrdetail = (id) => fetch(`/brand/detail?id=${id}`)
// 全部分类
export const categoryApi = () => fetch('/catalog/index', {}, {}, 'GET')
export const catalogApi = (id) => fetch('/catalog/current', id, {}, 'GET')
// 页面请求数据 /topic/list
export const Apitopic = (data) => fetch('/topic/list', data, {}, 'GET')
// 品牌详情中的产品列表 /goods/list
export const goodsApi2 = (keyword, order) => fetch(
	`/goods/list?categoryId=0&page=1&size=20&keyword=${keyword}&sort=price&order=${order}`, {}, {},
	'GET')
// 搜索窗口数据 /search/index
// 要传token!!
// export const searchApi = (token) => fetch('/search/index', {}, {
// 	token: token
// }, 'GET')
// 分类
// 首页分类
export const gosApi = (idd) => fetch('/goods/category', idd, {}, 'GET')
export const listApi = (data) => fetch('/goods/list', data, {}, 'GET')
// 获取购物车 /cart/index
// export const cartApi = (token) => fetch('/cart/index', {}, {
// 	'X-Nideshop-Token': token
// }, 'GET')
export const cartApi = (token) => fetch('/cart/index', {}, {}, 'GET')
// 搜索框
// export const searchApi = (keyword) => fetch('baseurl/goods/list',keyword,{}, 'GET')
export const searchApi = (token) => fetch('/search/index', {}, {
	token: token
}, 'GET')
// 详情页/goods/detail
export const detailApi = (id) => fetch(`/goods/detail?id=${id}`, {}, {}, 'GET')
// 获取购物车产品数量
// export const goodscountApi = (token) => fetch(`/cart/goodscount`, {}, {
// 	'X-Nideshop-Token': token
// }, 'GET')
export const goodscountApi = (token) => fetch(`/cart/goodscount`, {}, {}, 'GET')
// 相关产品 /goods/related
export const relatedApi = (id) => fetch(`/goods/related?id=${id}`, {}, {}, 'GET')
// 添加到购物车/cart/add
// export const addApi = (obj, token) => fetch(`/cart/add`, obj, {
// 	'X-Nideshop-Token': token
// })
export const addApi = (obj, token) => fetch(`/cart/add`, obj, {})
// 获取购物车数据 /cart/indexs
// 清除搜索框记录 search/clearhistory
// export const clearhistoryApi = (token) => fetch(`/search/clearhistory`, {}, {
// 	'X-Nideshop-Token': token
// })
export const clearhistoryApi = (token) => fetch(`/search/clearhistory`, {}, {})
// 实时搜索 /search/helper
// export const helperApi = (token, keyword) => fetch(`/search/helper?keyword=${keyword}`, {}, {
// 	'X-Nideshop-Token': token
// })
export const helperApi = (token, keyword) => fetch(`/search/helper?keyword=${keyword}`, {}, {})
// 商品步进器 /cart/update
// export const cartaddApi = (goodsId, id, number, productId) => fetch(`/cart/update`, {
// 	goodsId: goodsId,
// 	id: id,
// 	number: number,
// 	productId: productId
// }, {

// })
export const cartaddApi = (obj) => fetch(`/cart/update`,
	obj)
// 切换商品选中状态 cart/checked
export const checkedApi = (obj) => fetch(`/cart/checked`, obj)
